home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr27 / ifits00.zip / IFITS.DOC next >
Text File  |  1995-03-06  |  12KB  |  244 lines

  1.  
  2.     IFITS  v0.0 - System clock check and errorlevel set utility  (C) 1994
  3.     Glen Gilbert -=- Patriot BBS -=- 8:1006/0@fmlynet - 1:157/534@fidonet
  4.     ─────────────────────────────────────────────────────────────────────
  5.  
  6.     Usage:
  7.     IFITS -T[03:00] +T[05:00] !D[1-31] -W[1-7] =M[1] -Y[1993] /E[99] /Q
  8.  
  9.     IFITS is another DOS errorlevel setting utility to be used within a
  10.     batch file process. IFITS checks the system clock and compares all
  11.     the parameters to your input and returns an errorlevel appropriate
  12.     to the comparison. In other words, under the right conditions, IFITS
  13.     will run and then exit, setting a dos errorlevel which can be picked
  14.     up within a batch process where it can be acted upon accordingly.
  15.  
  16.     In case you're wondering what use such a program has, my own system
  17.     serves as a hub. The nec's system sends the mail in a series of of
  18.     small bundles. This keeps my hard drive tossing, packing and linking
  19.     for hours. Ifits allows the system to receive mail for a couple of
  20.     hours without processing it. This lets the small bundles build up, so
  21.     a lot of the mail will be done all at the same time. It's like taking
  22.     one trip to the store every couple of days instead of every time one
  23.     thing is needed. Another use is to archive, delete or move log files
  24.     on a weekly, monthly, yearly or anything in between basis. If you
  25.     moderate an echo, you can have IFITS tell MsgPost to send weekly echo
  26.     rule messages. IFITS is only limited by dos and one's imagination.
  27.  
  28.     The following is a basic example of IFITS within a batch file.
  29.  
  30.     @echo off
  31.     IFITS +t23:59 -t22:10 =w1 +d7 /e99
  32.     if errorlevel 99 goto ItsTime
  33.     goto ItsNotTime
  34.     :ItsTime
  35.     squish get IFITS from 1:157/534 normal
  36.     goto I'mOutOfHere
  37.     :ItsNotTime
  38.     echo I'm not supposed to do anything at this time so I'll go away!
  39.     :I'mOutOfHere
  40.     exit
  41.  
  42.     What this batch file accomplishes:
  43.     1. IFITS is called
  44.     2. System clock is checked to see if_it's within the range of 10
  45.        minutes before midnight and 10 minutes after 10pm
  46.     3. System day of the week is checked to see if_it's Sunday
  47.     4. System date is checked to see if its BEFORE the 7th of the
  48.        month
  49.     5. An errorlevel of 99 will be set within the operating system if
  50.        conditions of items 2(a and b) through 4 are all met (returned
  51.        true)
  52.  
  53.     Line #2 test the errorlevel condition and the batch process will
  54.     jump to the line (label) ":ItsTime" and proceed with processing
  55.     from that point. Otherwise the "goto ItsNotTime" will direct the
  56.     processing to the label ":ItsNotTime" where the "echo" statement
  57.     will print the message "I'm not supposed to do anything" etc. to
  58.     the console and "exit" the batch process.
  59.  
  60.     If the :ItsTime section of the batch is executed, the program
  61.     Squish.exe will be called upon and providing both it and its
  62.     configuration file are found AND there are no halting errors, a
  63.     file request will be generated for the magic file name "IFITS",
  64.     addressed to 1:157/534 as a normal flavored attach request.
  65.  
  66.     Of course IFITS isn't restricted to using a relatively complex
  67.     process such as that described above. You may not even know
  68.     what a "squish", "file request" or "magic name" refers to. The
  69.     important thing to know is that IFITS can check each component
  70.     of your system clock, compare it to the specifics on the
  71.     IFITS command line and produce a value within the dos operating
  72.     system according to the result of the comparison.
  73.  
  74.     Probably the most difficult thing about using ifits will be
  75.     hooking it into your batch process. However, remembering the
  76.     + and - identifier properties may pose a problem. Just say it
  77.     as you are creating the command line..
  78.  
  79.     If it's BEFORE 5:30am [and] AFTER midnight exit with 255.
  80.  
  81.     IFITS +T05:30 -T00:00 /E255
  82.  
  83.     Or, you can turn it around..
  84.  
  85.     IFITS /E255 -T00:00 +T05:30
  86.  
  87.     .. exit with 255 if_it's AFTER midnight and BEFORE 5:30am
  88.  
  89.     The designator is easily left out (T,D,W,M,Y). IFITS will let you
  90.     know when you have omitted one of them.
  91.  
  92.     An important factor to know is that all conditions must be TRUE
  93.     in order for IFITS to exit with the prescribed errorlevel. In
  94.     other words, IFITS !T12:00 /E255 - if_it's NOT noon, exit with
  95.     255. It must NOT be noon for IFITS to consider the statement to
  96.     be TRUE. Each and every statement in turn must prove to be TRUE
  97.     no matter how many are used. If just one argument returns FALSE,
  98.     IFITS will exit with errorlevel 0.
  99.  
  100.     Other caveats are mentioned near the end of this document.
  101.     But first, here's the descriptions of each command line token.
  102.  
  103.     Parameter switches (arguments) '-', '+', '!', '=' and '/'
  104.     ────────────────────────────────────────────────────────
  105.  
  106.     '-' The MINUS switch translates to the word "AFTER" and can
  107.     be used with the 'T', 'M', 'D', 'W' and 'Y' functions.
  108.  
  109.     '+' The PLUS switch translates to the word "BEFORE" and can
  110.     be used with the 'T', 'M', 'D', 'W' and 'Y' functions.
  111.  
  112.     '!' The NOT switch translates to the word "NOT" and can be
  113.     used with the 'T', 'M', 'D', 'W' and 'Y' functions. When using
  114.     this switch, the system time is calculated in hours and minutes
  115.     only. You have a 60 second window where your input and the
  116.     system clock will match.
  117.  
  118.     '=' The EQUAL switch translates to the word "EQUALS" and can
  119.     be used with the 'T', 'M', 'D', 'W' and 'Y' functions. When using
  120.     this switch, the system time is calculated in hours and minutes
  121.     only. You have a 60 second window where your input and the system
  122.     clock will match.
  123.  
  124.     '/' the forward slash switch can be used with the 'E' and  'Q'
  125.     functions.
  126.  
  127.  
  128.     Function flags T, M, D, W, E, Q and Y
  129.     ─────────────────────────────────────
  130.  
  131.     'T' tells IFITS that what follows is a [T]ime parameter. 24
  132.     hour time is expected, exclusively. The program checks for that
  133.     input in the form of HH:MM or HH:MM:SS and either accepts or
  134.     rejects the parameter accordingly. Only digits are accepted
  135.     where HH, MM and SS are specified and only a colon is accepted
  136.     as a delineator between the HH, MM and optional SS parameter.
  137.     The acceptable range for HH is 00 - 23. The acceptable range
  138.     for MM and the optional SS is 00 - 59  in the form:
  139.     (switch)T[HH:MM:SS]  ie +T23:59:59
  140.     NOTE: 01:00:00 = 1am  13:00:00 = 1pm etc..
  141.  
  142.     'M' tells IFITS that what follows is a [M]onth parameter.
  143.     Specifically the number of the month within the year.
  144.     Acceptable range for what follows is the digit sequence 1
  145.     through 12 in the form (switch)M[1 - 12]  ie =M10
  146.     NOTE: 1=Jan 2=Feb etc..
  147.  
  148.     'D' tells IFITS that what follows is a [D]ate parameter.
  149.     Specifically the number of the day within a month. Acceptable
  150.     range for what follows is the digit sequence 1 through 31 in
  151.     the form (switch)D[1 - 31]  ie !D21
  152.  
  153.     'W' tells IFITS that what follows is a [W]eek_day parameter.
  154.     Specifically the number of the day within a week. Acceptable
  155.     range for what follows are the digits 1 through 7. "1" being
  156.     Sunday and "7" being Saturday in the form (switch)W[1 - 7]
  157.     ie =W3  ..
  158.     NOTE:  1=Sun 2=Mon 3=Tue 4=Wed 5=Thu 6=Fri 7=Sat
  159.  
  160.     'Y' tells IFITS that what follows is a [Y]ear parameter.
  161.     Specifically a four digit sequence such as 1994. Acceptable
  162.     range is whatever the the system clock and dos function are
  163.     capable of reporting. Form is (switch)Y[MCDY]  ie =Y1994
  164.  
  165.     'E' tells IFITS that what follows is an [E]rrorlevel parameter.
  166.     Specifically a 1 to 3 digit sequence in the range of 1 - 255.
  167.     Form is /E[1 - 255]  ie /E99
  168.  
  169.     'Q' tells IFITS that the program is NOT to send any runtime
  170.     print to the console (screen). It is the QUIET mode.
  171.     Form is /Q  ie /Quiet
  172.  
  173.     IFITS can check ranges ie -D5 +D15 -M5 +M10 !M7 !M8 -T14:00 /E99
  174.     An errorlevel of 99 will be set if_it's before the 15th and after
  175.     the 5th of the month. It must also be after May and before October.
  176.     However, it can't be July or August. Finally, it must be before
  177.     2 o'clock pm.
  178.  
  179.     IFITS' precision when using the ! and = identifiers is exact when
  180.     confronting day_of_week(!W, =W), day_of_month(!D, =D), month(!M, =M)
  181.     and year(!Y, =Y). However, Time is a slightly different circumstance.
  182.     It is unlikely that IFITS !T12:00:00 or IFITS =T08:00:00 will ever
  183.     produce anything but an affirmative (TRUE) condition for the !T and
  184.     nothing but a negative (FALSE) return for =T. Hitting either on the
  185.     second is highly improbable. Therefore, IFITS allows a 59 second
  186.     tolerance to the positive when using either of these identifiers with
  187.     the Time factor. IFITS !T12:00:00 will return FALSE if the system
  188.     clock is in the range of 12:00:00 - 12:00:59. The principle applies
  189.     to =T08:00:00 in regard to returning TRUE. The range to return TRUE
  190.     under this condition is 08:00:00 - 08:00:59
  191.  
  192.     IFITS works within the same day when handling -T, +T parameters.
  193.     For instance, IFITS +T00:00 /E255 will always return false and
  194.     errorlevel 255 will never be produced as there can be no time
  195.     before midnight.
  196.  
  197.     IFITS -T02:00 +T01:00 /E255  can never produce an errorlevel exit
  198.     as it can't be AFTER(-) 2am and BEFORE(+) 1am at the same time.
  199.     This holds true with all the - and + parameters.
  200.     Neither will IFITS -D21 +D19 /E255 as the date cannot be after the
  201.     21st and before the 19th at the same time. Just as IFITS -W7 /E255
  202.     is an impossibility.. A little thought needs to go into anything
  203.     but the simplest command line.
  204.  
  205.     If you need to select several months, weekdays or dates.. Using the
  206.     "=" attributes consecutively will not work unfortunately. Where the
  207.     clock equals one day, month, date or year, it will surely return
  208.     a miss for the other. For instance IFITS =W3 =W7 /E255 will forever
  209.     fail because it obviously cannot be Tuesday and Saturday at the
  210.     same time. The same goes with the other identifiers. To achieve the
  211.     example above you would use IFITS !W1 !W2 !W4 !W5 !W6 /E255. Doing
  212.     the same with the other identifiers such as dates and time can be
  213.     lengthy or impossible. If the check list goes beyond dos' 128
  214.     character line length, you can run one or a series of IFITS checks.
  215.     In otherwords, you can chain IFITS patterns, linking them through
  216.     errorlevels until you succeed through the total checklist.
  217.  
  218.     Although IFITS does considerable command checking, you can cause
  219.     the program to go berserk by loading an option with too many
  220.     characters. Such as IFITS -T12:00ABCDEFGHIJKLMNOPQRSTUVWXYZ /E255
  221.  
  222.     ────────────────────────────────────────────────────────────────
  223.  
  224.     IFITS is free but it is not to be packaged with other software
  225.     without the author's consent. Nor may other software be packaged
  226.     with IFITS. If it is to be distributed, the archive must contain
  227.     this document (ifits.doc) and original unaltered executable.
  228.  
  229.     Use IFITS at your own risk. The author takes NO responsibility
  230.     for any possible damage which could occur due to its use. If you
  231.     are skeptical about the safety of using this program and do not
  232.     wish to take precautionary measures to insure IFITS will do no
  233.     damage, then do not use it.
  234.  
  235.     Acknowledgement, comments and suggestions of a constructive
  236.     nature are appreciated. Please send them to:
  237.  
  238.     Glen Gilbert  8:1006/0@fmlynet
  239.                   1:157/534@fidonet   (216)628-4860 data/fax
  240.  
  241.     Thanks to;
  242.     Chris Mann and Bob Wratz for testing IFITS before it made out
  243.     your way.
  244.